#ifndef SDR_SCREEN_H_INCLUDED
#define SDR_SCREEN_H_INCLUDED

#include "SDragon_GeneralIncludes.h"

#include "SDR_Cursor.h"
#include "SDR_SurfaceList.h"
#include "SDR_Event.h"
#include "SDR_AnimationList.h"

#define SDR_WindowDefault_sdlFlags (SDL_INIT_VIDEO | SDL_INIT_TIMER)
#define SDR_WindowDefault_screenFlags (SDL_HWSURFACE | SDL_DOUBLEBUF)
#define SDR_WindowDefault_width 640
#define SDR_WindowDefault_height 480

struct SDR_Window
{
    uint32_t sdlFlags;
    uint32_t screenFlags;

    uint16_t width;
    uint16_t height;

    SDL_Surface * screen;
    SDL_Surface * screenWithoutCursor;
    SDL_mutex * mutex;

    SDR_Cursor * cursor;
    char * dataDir;

    SDR_SurfaceList surfaceList;
    SDR_AnimationList animationList;

    SDR_EventList eventList;
    //SDL_Event lastMouseMotion;

    SDL_Thread * windowMotorThread;
    SDL_Thread * animationMotorThread;

    uint8_t initialised;
    uint8_t updateScreen;
};
typedef struct SDR_Window SDR_Window;


#define SDR_lock(window) SDL_LockMutex(window->mutex)
#define SDR_unlock(window) SDL_UnlockMutex(window->mutex)

#define SDR_forceUpdate(window) window->updateScreen = 1

#endif // SDR_SCREEN_H_INCLUDED
